/**
 * isCommonAppBroswer的选项
 * @interface IIsCommonAppBroswerOptions
 */
interface IIsCommonAppBroswerOptions {
  /** 要匹配的内容，正则表达式，默认为/(micromessenger|qq|weibo)/i */
  pattern?: RegExp;
}

/**
 *
 * 是否是常见的APP的内置浏览器，默认匹配微信、QQ、微博
 * @export
 * @since 1.0.2
 * @param {string} [ua=navigator.userAgent.toLowerCase()] 浏览器ua
 * @param {IIsCommonAppBroswerOptions} [options={}]
 * @param {RegExp} [options.pattern=/(micromessenger|qq|weibo)/i]
 * 要匹配的内容，正则表达式，默认为/(micromessenger|qq|weibo)/i
 * @return {boolean}
 */
export default function isCommonAppBroswer(
  ua:string = navigator.userAgent.toLowerCase(),
  { pattern = /(micromessenger|qq|weibo)/i }:IIsCommonAppBroswerOptions = {},
): boolean {
  return pattern.test(ua);
}
